<?php

/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use app\assets\AppAsset;
use yii\data\ActiveDataProvider;
use app\models\CwNav;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <?= Html::csrfMetaTags() ?>
    <title><?= Yii::$app->params['app_name']?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

<div class="wrap">
    <div class="container" style="padding: 20px 0;">
        <a href="<?= Yii::$app->homeUrl?>">            
            <div class="pull-left col-lg-4 col-md-4 col-sm-5 col-xs-12">
                <h1><?= Yii::$app->params['app_name']?><small><?= Yii::$app->params['app_name_en']?></small></h1>
            </div>
        </a>
        <div class="pull-right col-lg-4 col-md-4  text-center">
            <h5>
                <a href="#"><i class="glyphicon glyphicon-thumbs-up"></i><?= Yii::$app->params['app_name']?></a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="#"><i class="glyphicon glyphicon-globe"></i><?= Yii::$app->params['app_spread']?></a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="#"><i class="glyphicon glyphicon-qrcode"></i><?= Yii::$app->params['app_wechat']?></a>
            </h5>
            <h4><i class="glyphicon glyphicon-earphone"></i><?= Yii::$app->params['app_tel']?></h4>
        </div>
        
        <?php
            $navbar = new ActiveDataProvider([
                'query' => CwNav::find(),
            ]);
        ?>

    </div>
    
    <div id="temp-navbar" class="navbar navbar-default" style="margin-bottom: 0;">
        <div class="container">            
            <ul class="nav navbar-nav">
                <?php
                    foreach ($navbar->models as $nav){
                        $navlist = "";
                        if($nav->nav_level==1){
                            foreach ($navbar->models as $navc){
                                if ($navc->nav_level==2&&$navc->nav_dady==$nav->nav_name){
                                    $navlist =$navlist.'<li><a href="'.$navc->nav_link.'"><i class="glyphicon glyphicon-chevron-right"></i>'.$navc->nav_name.'</a></li>';
                                }
                            }
                            echo '<li class="dropdown"><a id="n'.$nav->nav_id.'" class="dropdown-toggle" href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$nav->nav_name.'<span class="caret"></span></a><ul class="dropdown-menu" aria-labelledby="n'.$nav->nav_id.'">'.$navlist.'</ul></li>';
                        }
                    }
                ?>
            </ul>
        </div>
    </div>
    

    <div style="padding: 0;">
        <?= $content ?>
    </div>
</div>

<footer class="footer">
    <div class="container">
        <p class="pull-left">&copy; <?= Yii::$app->params['app_company']?> <?= date('Y') ?></p>

        <p class="pull-right">Powered by Lione <a href="#" data-toggle="modal" data-target="#myModal">CatWalk</a></p>
    </div>
</footer>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><?= Yii::$app->params['cms_version']?></h4>
      </div>
        <div class="modal-body" style="height: 500px; background-image: url(./img/CatWalk.png); background-size: cover">
        
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<?php $this->endBody() ?>
</body>
<script>
    $('.index-section').mousemove(function(){
        $(this).find('.index-section-item-text').stop().show();
    });
    $('.index-section').mouseleave(function(){
        $(this).find('.index-section-item-text').stop().hide();
    });
    $('.panel-ex').mousemove(function(){
       $(this).find(".title-ex").hide(); 
       $(this).find(".explain-ex").show(); 
    });
    $('.panel-ex').mouseleave(function(){
       $(this).find(".title-ex").show(); 
       $(this).find(".explain-ex").hide(); 
    });
</script>
</html>
<?php $this->endPage() ?>
